using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
class Program
{
    static void Main(string[] args)
    {
 
        int[] n = new int[10];
 
        for (int i = 1; i < 9; i++)
        {
            n[i] = int.Parse(Console.ReadLine());
        }
 
        int bestlength = 1;
        int bestlengthcount = 1;
        int count = 1;
         
 
        int[,] field = new int[10, 10];
 
        for (int i = 0; i < n.GetLength(0); i++)
        {
            for (int j = 1; j < field.GetLength(0); j++)
            {
                field[i, j] = n[i]%2;
                n[i] /= 2;
            }
        }
 
        for (int i = 1; i < field.GetLength(0)-1; i++)
        {
            for (int j = 1; j < field.GetLength(1)-1; j++)
            {
                if ((field[i, j] == field[i, j+1])&&(field[i, j] == 1))
                {
                    count++;
                }
                else
                {
                    if (count>bestlength)
                    {
                        bestlength = count;
                        bestlengthcount = 1;
                        count = 1;
                    }
                    else if (count==bestlength)
                    {
                        bestlengthcount++;
                        count = 1;
                    }
                    else
                    {
                        count = 1;
                    }
                }
                
            }
        }
        for (int j = 0; j < field.GetLength(0) - 1; j++)
        {
            for (int i = 0; i < field.GetLength(1) - 1; i++)
            {
                if ((field[i, j] == field[i + 1, j]) && (field[i, j] == 1))
                {
                    count++;
                }
                else
                {
                    if (count > bestlength)
                    {
                        bestlength = count;
                        bestlengthcount = 1;
                        count = 1;
                    }
                    else if (count == bestlength)
                    {
                        bestlengthcount++;
                        count = 1;
                    }
                    else
                    {
                        count = 1;
                    }
                }
 
            }
        }
 
        //for (int i = 0; i < n.GetLength(0); i++)
        //{
        //    for (int j = 0; j < field.GetLength(1); j++)
        //    {
 
        //        Console.Write(field[i, j]);
                  
 
        //    }
        //    Console.WriteLine();
        //}
   
         
 
        Console.WriteLine(bestlength);
        Console.WriteLine(bestlengthcount);
 
    }
}